package com.shicijiaoliu.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@NoArgsConstructor
@AllArgsConstructor
@Data
public class result <T>{
    private Integer code;//0 成功,1 失败
    private String message;//提示信息
    private T data;//返回数据

    public static <E> result<E> success(E data){
        return new result<>(0,null,data);
    }

    public static <E> result<E> success(){
        return new result(0,null,null);
    }

    public static result error(String message){
        return new result(1,message,null);
    }
}
